require(['./config'],()=>{
	require(['template','header','footer','bootstrap'],(template)=>{
		class Category{
			constructor() {
			    this.getList()
				this.gettitlePic()
			}
			getList(){
				//从地址栏取到id根据id获取数据
				//location.search
			// 	const id=location.search.slice(4)
			// 	$.get('http://rap2api.taobao.org/app/mock/268441/api/listgoods',resp=>{
			// 		console.log(resp)
			// 		if(resp.code===200){
			// 		// // const {listname}= resp.body
			// 		const {list}= resp.body.item
			// 		// console.log($('#goodclasslist'))
			// 		$('#goodclasslist').html(template('goodclasslistTemplate',{list}))
			// 		}
			
			// 	})
				const id=location.search.slice(4)
				$.get(`http://www.xiongmaoyouxuan.com/api/tab/${id}`,{start:0},resp=>{
					if(resp.code===200){
						console.log(resp)
						// const {cname}= resp.data.category
						const {list}=resp.data.items
						// console.log({cname,list})
						// console.log(categories)
						$('#goodclasslist').html(template('goodclasslistTemplate',{list}))
					}
				})
			}
			//获得头部图片
			gettitlePic(){
				$.get('http://rap2api.taobao.org/app/mock/268441/api/titlepic',resp=>{
					console.log(resp)
					const{body}=resp
					const html=template('picshowTemplate',{body})
					// console.log(html)
					$('#picshow').html(html)
				})
			}
		
		}
		new Category()
	})
})